canAjaxCallback

Arguments

eobject

An object with the following properties:

xbasicFunctionNamestring

The Xbasic function that was called in the Ajax Callback.

ajaxEventstring

The name of the event that triggered the Ajax Callback.

callbackIdstring

A GUID that identifies the callback, allowing you to match it in the afterAjaxCallbackComplete event for a specific callback.

Description

Fires before an Ajax callback. If the function returns false, the callback will be aborted.

Discussion

The canAjaxCallback client-side event is called when a request is made to the server. The event can be used to stop an Ajax Callback or capture and store information about the callback (such as the callback ID or Xbasic function name) for use in other events (onAjaxCallbackFailed, afterAjaxCallbackComplete, etc).

The simple example below prevents the callback to execute an Xbasic function called "doCallback" if a List control called 'LIST1' has unsaved edits.

Example

if (e.xbasicFunctionName == "doCallback") {
    var lobj = {dialog.object}.getControl('LIST1');
    if (lobj && lobj.hasPendingEdits()) {
        var title = 'Unsaved Changes';
        var message = '<div>Please save or cancel your changes first.</div>';
        A5.msgBox.show(title,message,'o');
        return false;
    }
}
return true;

See Also